# -*- coding:utf-8 -*-
# Author: Joshua Conero
import time
from typing import Callable

AUTHOR = 'Joshua Conero'
TIME_SINCE = '2020-05-09'
DESCRIBE = "conero's util package"

# 版本信息
__version__ = '0.1.0'
# 发布日期，dev/20060102
__release__ = "dev"


def get_time_spend() -> Callable[[], str]:
    """
    获取执行时间
    :return:
    """
    start_time = time.time()

    # 统计时间白哦
    def diff_time_now() -> str:
        nonlocal start_time
        # 获取秒
        time_diff = time.time() - start_time
        return f"{time_diff} s"

    return diff_time_now
